﻿'''
LCR 182.动态口令/左旋转字符串
某公司门禁密码使用动态口令技术。初始密码为字符串 password，密码更新均遵循以下步骤：
设定一个正整数目标值 target
将 password 前 target 个字符按原顺序移动至字符串末尾
请返回更新后的密码字符串。
示例 1：
输入: password = "s3cur1tyC0d3", target = 4
输出: "r1tyC0d3s3cu"
示例 2：
输入: password = "lrloseumgh", target = 6
输出: "umghlrlose"
提示：
1 <= target < password.length <= 10000
'''
#读取输入   切片+拼接
password = input()
target = int(input())
s = password[:target]
t = password[target:]
new_psw = t + s
print(new_psw)
'''
class Solution(object):
    def dynamicPassword(self,password:str,target:int)->str:
        #直接字符串切片
        #return password[target:] + password[0:target]

        #局部反转+整体反转
        #result = list(password)
        #result[0:target]  = list(reversed(result[0:target]))
        #result[target:] = list(reversed(result[target:]))
        #result = list(reversed(result))
        #return ''.join(result) 
        
        #取模操作
        n = len(password)
        result =''
        for i in range(n):
            j = (i + target)%n
            result = result + password[j]
        return result

#示例
if __name__ == '__main__':
    password = "s3cur1tyC0d3"
    target = 4
    password1 = "lrloseumgh"
    target1 = 6
    print(Solution().dynamicPassword(password,target))
    print(Solution().dynamicPassword(password1,target1))
'''



